home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1998 January / PC Answers Issue 49 Cover CD January 1998.iso / Apps / Director / DATA.Z / Widget Wizard.dir / WidgtBehaviors_33_beep-2pict.ls < prev    next >
Encoding:
Text File  |  1997-05-10  |  2.1 KB  |  80 lines

  1. property UpCM, DownCM, button_active, whichevent
  2.  
  3. on getPropertyDescriptionList
  4.   set description to [:]
  5.   if the currentSpriteNum = 0 then
  6.     set memdefault to 0
  7.   else
  8.     set memref to the member of sprite the currentSpriteNum
  9.     set castLibNum to the castLibNum of memref
  10.     set memdefault to member (the memberNum of member memref + 1) of castLib castLibNum
  11.   end if
  12.   addProp(description, #DownCM, [#default: memdefault, #format: #bitmap, #comment: "Pict for Down:"])
  13.   addProp(description, #whichevent, [#default: #mouseUp, #format: #symbol, #comment: "Beep On Which Event:", #range: [#mouseUp, #mouseDown, #mouseEnter, #mouseLeave, #mouseUpOutSide]])
  14.   return description
  15. end
  16.  
  17. on getBehaviorDescription
  18.   return "Button, auto set up pict, switch pict down, beep on user defined event"
  19. end
  20.  
  21. on getAssocMembers
  22.   set myPropList to [DownCM]
  23.   return myPropList
  24. end
  25.  
  26. on showScriptRefs me
  27.   put the scriptInstanceList of sprite the spriteNum of me
  28. end
  29.  
  30. on beginSprite me
  31.   set the UpCM of me to the member of sprite the spriteNum of me
  32.   set the button_active of me to 0
  33.   puppetSprite(the spriteNum of me, 1)
  34. end
  35.  
  36. on endSprite me
  37.   puppetSprite(the spriteNum of me, 0)
  38. end
  39.  
  40. on mouseDown me
  41.   set the member of sprite the spriteNum of me to member the DownCM of me
  42.   set the button_active of me to 1
  43.   if the whichevent of me = #mouseDown then
  44.     beep()
  45.   end if
  46. end
  47.  
  48. on mouseUp me
  49.   set the member of sprite the spriteNum of me to member the UpCM of me
  50.   set the button_active of me to 0
  51.   if the whichevent of me = #mouseUp then
  52.     beep()
  53.   end if
  54. end
  55.  
  56. on mouseUpOutSide me
  57.   set the button_active of me to 0
  58.   if the whichevent of me = #mouseUpOutSide then
  59.     beep()
  60.   end if
  61. end
  62.  
  63. on mouseLeave me
  64.   if the button_active of me then
  65.     set the member of sprite the spriteNum of me to member the UpCM of me
  66.   end if
  67.   if the whichevent of me = #mouseLeave then
  68.     beep()
  69.   end if
  70. end
  71.  
  72. on mouseEnter me
  73.   if the button_active of me then
  74.     set the member of sprite the spriteNum of me to member the DownCM of me
  75.   end if
  76.   if the whichevent of me = #mouseEnter then
  77.     beep()
  78.   end if
  79. end
  80.